﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using DuncanDAL;

namespace BLL.EarningService
{
    /// <summary>
    /// 添加新收入业务对象
    /// </summary>
    public class AddEarningRecordTransaction:ICommand
    {
        private T_EarningRecordsObject earningRecordsObject;

        public AddEarningRecordTransaction(T_EarningRecordsObject _EarningRecordsObject)
        {
            this.earningRecordsObject = _EarningRecordsObject;
        }

        private bool opState = false;

        public bool OpState
        {
            get
            {
                return opState;
            }
        }

        #region ICommand 成员

        public void Execute()
        {
            if (earningRecordsObject == null)
            {
                throw new NullReferenceException("传入的对象为空！");
            }
            EarningRecordsDataService objEarningRecordsDataService = new EarningRecordsDataService();
            objEarningRecordsDataService.Create(earningRecordsObject);
            opState = true;
        }

        #endregion
    }
}
